package java_language;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * @Author Jun jie Yi
 * 2022/3/23 16:05
 */

public class Demo2 {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<String> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            String next = sc.next();
            list.add(next);
        }
        returnResult(list);
    }

    public static void returnResult(List<String> list) {
        List<String> list1 = new ArrayList<>();
        for (int i = 0; i < list.size(); i++) {
            String next = list.get(i);
            char[] cs = next.toCharArray();
            //1.如果长度不合法输出 illegal length
            if (cs.length < 6 || cs.length > 12) {
                System.out.println("illegal length");
                //2.如果长度合法但是出现英文字母以外的字符
            } else if (cs.length >= 6 && cs.length <= 20) {
                int flag = 0;//无非字母
                //判断是否含有非字母
                for (int j = 0; j < cs.length; j++) {
                    if (!(((byte) cs[j] >= 'a' && (byte) cs[j] <= 'z') || ((byte) cs[j] >= 'A' && (byte) cs[j] <= 'Z'))) {
                        System.out.println("illegal charactor");
                        flag = 1;//有非字母
                    }
                }
                if (flag == 0) {
                    if (list1.contains(next)) {
                        System.out.println("account existed");
                    } else {
                        System.out.println("registration complete");
                        list1.add(next);//保存数据
                    }
                }
            }
        }
    }
}
